import Mock from 'mockjs'

// 设置全局配置
Mock.setup({
  timeout: '100-600'
})

// 生成大屏列表数据
const generateScreenList = () => {
  return Mock.mock({
    'list|10': [{
      'id|+1': 1,
      'name': '@ctitle(5, 10)',
      'description': '@cparagraph(1, 2)',
      'thumbnail': Mock.Random.image('400x300', '#4A7BF7','DataV'),
      'createTime': '@datetime("yyyy-MM-dd HH:mm:ss")',
      'updateTime': '@datetime("yyyy-MM-dd HH:mm:ss")',
      'status|1': ['published', 'draft'],
      'creator': '@cname'
    }]
  }).list
}

// 注册大屏相关接口
const setupScreenMock = () => {
  // 列表接口
  // Mock.mock('/api/screen/list', 'get', {
  //   code: 200,
  //   data: generateScreenList(),
  //   message: 'success'
  // })

  // 删除接口
  Mock.mock(/\/api\/screen\/delete\/\d+/, 'delete', {
    code: 200,
    data: null,
    message: '删除成功'
  })
}

export default setupScreenMock 